home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / kexec-tools.postinst < prev    next >
Encoding:
Text File  |  2010-10-18  |  2.9 KB  |  108 lines

  1. #! /bin/sh 
  2. # postinst script for kexec-tools
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. update_param() {                                                               
  9.         eval old=\"'$'$1\"
  10.         eval new=\"'$'new_$1\"
  11.  
  12.         if test "$old" = "$new"; then
  13.                 return
  14.         fi
  15.  
  16.         if test -z "$old"; then
  17.                 grep -Eq "^ *$1=" "$INITCONFFILE" || echo "$1=" \
  18.                        >> "$INITCONFFILE"
  19.         fi
  20.  
  21.     sed -e "s/^ *$1=.*/$1=$new/" < $INITCONFFILE > $INITCONFFILE.$$
  22.     mv -f $INITCONFFILE.$$ $INITCONFFILE
  23. }
  24.  
  25. # summary of how this script can be called:
  26. #        * <postinst> `configure' <most-recently-configured-version>
  27. #        * <old-postinst> `abort-upgrade' <new version>
  28. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  29. #          <new-version>
  30. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  31. #          <failed-install-package> <version> `removing'
  32. #          <conflicting-package> <version>
  33. # for details, see http://www.debian.org/doc/debian-policy/ or
  34. # the debian-policy package
  35. #
  36.  
  37. case "$1" in
  38.     configure)
  39.     if [ -L /etc/rc6.d/K39kexec-load ]; then
  40.         # remove this old entry, we'll add correct one below
  41.         update-rc.d -f kexec-load remove > /dev/null || exit 0
  42.     fi
  43.     ;;
  44.  
  45.     abort-upgrade|abort-remove|abort-deconfigure)
  46.     exit 0    
  47.     ;;
  48.  
  49.     *)
  50.         echo "postinst called with unknown argument \`$1'" >&2
  51.         exit 1
  52.     ;;
  53. esac
  54.  
  55. # Handle debconf
  56. . /usr/share/debconf/confmodule
  57.                                                                                                                               
  58. INITCONFFILE=/etc/default/kexec
  59.  
  60. # We generate several files during the postinst, and we don't want
  61. #       them to be readable only by root.
  62. umask 022
  63.  
  64. # Generate configuration file if it does not exist, using default values.
  65. [ -r "${INITCONFFILE}" ] || {
  66.         echo Generating ${INITCONFFILE}... >&2
  67.         cat >${INITCONFFILE} <<'EOFMAGICNUMBER1234'
  68. # Defaults for kexec initscript
  69. # sourced by /etc/init.d/kexec and /etc/init.d/kexec-load
  70.  
  71. # Load a kexec kernel (true/false)
  72. LOAD_KEXEC=true
  73.  
  74. # Kernel and initrd image
  75. KERNEL_IMAGE="/vmlinuz"
  76. INITRD="/initrd.img"
  77.  
  78. # If empty, use current /proc/cmdline
  79. APPEND=""
  80. EOFMAGICNUMBER1234
  81. }
  82.  
  83. . ${INITCONFFILE}
  84. # ------------------------- Debconf questions start ---------------------
  85.  
  86. db_get kexec-tools/load_kexec || RET=true
  87. new_LOAD_KEXEC="${RET}"
  88. update_param LOAD_KEXEC
  89. db_stop
  90.                                                                                                                               
  91. # ------------------------- Debconf questions end ---------------------
  92.  
  93. # Automatically added by dh_installinit
  94. if [ -x "/etc/init.d/kexec" ]; then
  95.     update-rc.d kexec start 85 6 . >/dev/null || exit $?
  96. fi
  97. # End automatically added section
  98. # Automatically added by dh_installinit
  99. if [ -x "/etc/init.d/kexec-load" ]; then
  100.     update-rc.d kexec-load stop 18 6 . >/dev/null || exit $?
  101. fi
  102. # End automatically added section
  103.  
  104.  
  105. exit 0
  106.  
  107.  
  108.